package com.zan.pattern.observer;

/**
 * @Author Zan
 * @Create 2024/4/27 15:34
 * @Description : TODO(请用一句话描述该类的功能)
 * @ClassName: Client
 */
public class Client {
    public static void main(String[] args) {
        // 创建公众号对象
        SubscriptionSubject subject = new SubscriptionSubject();

        // 用户订阅公众号
        WeiXinUser user1 = new WeiXinUser("张三");
        WeiXinUser user2 = new WeiXinUser("李四");
        WeiXinUser user3 = new WeiXinUser("王五");

        subject.attach(user1);
        subject.attach(user2);
        subject.attach(user3);

        // 公众号更新，发出消息通知订阅者（观察者对象）
        subject.notify("你好啊");
    }
}
